<div>
    <h2>
        <span>Posts</span>
        <button class="btn btn-primary float-right create-post" [routerLink]="['/', { outlets: { popup: ['post-new'] } }]">
            <span class="fa fa-plus"></span>
            <span >
            Create new Post
            </span>
        </button>
    </h2>
    <jhi-alert></jhi-alert>
    <div class="row">
    </div>
    <br/>
    <div class="table-responsive" *ngIf="posts">
        <table class="table table-striped">
            <thead>
            <tr>
            <th><span>ID</span></th>
            <th><span>Title</span></th>
            <th><span>Content</span></th>
            <th><span>Created On</span></th>
            <th></th>
            </tr>
            </thead>
            <tbody>
            <tr *ngFor="let post of posts ;trackBy: trackId">
                <td><a [routerLink]="['../post', post.id ]">{{post.id}}</a></td>
                <td>{{post.title}}</td>
                <td>{{post.content}}</td>
                <td>{{post.createdOn | date:'mediumDate'}}</td>
                <td class="text-right">
                    <div class="btn-group flex-btn-group-container">
                        <button type="submit"
                                [routerLink]="['../post', post.id ]"
                                class="btn btn-info btn-sm">
                            <span class="fa fa-eye"></span>
                            <span class="hidden-md-down">View</span>
                        </button>
                        <button type="submit"
                                [routerLink]="['/', { outlets: { popup: 'post/'+ post.id + '/edit'} }]"
                                replaceUrl="true"
                                class="btn btn-primary btn-sm">
                            <span class="fa fa-pencil"></span>
                            <span class="hidden-md-down">Edit</span>
                        </button>
                        <button type="submit"
                                [routerLink]="['/', { outlets: { popup: 'post/'+ post.id + '/delete'} }]"
                                replaceUrl="true"
                                class="btn btn-danger btn-sm">
                            <span class="fa fa-remove"></span>
                            <span class="hidden-md-down">Delete</span>
                        </button>
                    </div>
                </td>
            </tr>
            </tbody>
        </table>
    </div>
</div>
